<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>StringLeft / StringRight</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>StringLeft / StringRight</h1>

<p>Retrieves a number of characters from the left or right-hand side of 
a string.</p>

<pre class="Syntax">StringLeft, OutputVar, InputVar, Count
StringRight, OutputVar, InputVar, Count
NewStr := <a href="../Functions.htm#SubStr">SubStr</a>(String, StartPos [, Length]) <em>; See the <a href="../Functions.htm#SubStr">SubStr() function</a> for details.</em></pre>
<h3>Parameters</h3>
<dl>

  <dt>OutputVar</dt>
  <dd><p>The name of the variable in which to store the substring extracted from <em>InputVar</em>.</p></dd>

  <dt>InputVar</dt>
  <dd><p>The name of the variable whose contents will be extracted from.  Do not enclose the name in percent signs unless you want the <em>contents</em> of the variable to be used as the name.</p></dd>

  <dt>Count</dt>
  <dd><p>The number of characters to extract, which can be an <a href="../Variables.htm#Expressions">expression</a>. If <em>Count</em> is less than or equal to zero, <em>OutputVar</em> will be made empty (blank). If <em>Count</em> exceeds the length of <em>InputVar</em>, <em>OutputVar</em> will be set equal to the entirety of <em>InputVar</em>.</p></dd>

</dl>

<h3>Remarks</h3>
<p>For this and all other commands, <em>OutputVar</em> is allowed to be the same variable as an <em>InputVar</em>.</p>
<h3>Related</h3>
<p><a href="../Functions.htm#SubStr">SubStr()</a>, <a href="StringMid.htm">StringMid</a>, <a href="StringTrimLeft.htm">StringTrimLeft</a>, <a href="StringTrimLeft.htm">StringTrimRight</a>, <a href="IfInString.htm">IfInString</a>, <a href="StringGetPos.htm">StringGetPos</a>, <a href="StringLen.htm">StringLen</a>, <a href="StringLower.htm">StringLower</a>, <a href="StringLower.htm">StringUpper</a>, <a href="StringReplace.htm">StringReplace</a></p>
<h3>Example</h3>
<pre class="NoIndent">String = This is a test. 
StringLeft, OutputVar, String, 4  <em>; Stores the string &quot;This&quot; in OutputVar.</em>
StringRight, OutputVar, String, 5  <em>; Stores the string &quot;test.&quot; in OutputVar.</em></pre>

</body>
</html>
